<template>
  <van-swipe class="swiper" :autoplay="3000" lazy-render>
    <van-swipe-item v-for="image in bannerList" :key="image.picUrl" @click="jumpPage(image.linkUrl)">
      <img style="width: 100%;height: 100%;" :src="image.picUrl" />
    </van-swipe-item>
  </van-swipe>
  <Plate title="商品列表" />
  <GoodList />

  <Tabbar />
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue';
import api from '@/api'

interface BannerListInt {
  linkUrl: string
  picUrl: string
  [key: string]: any
}
interface ParamsInt {
  page: number
  pageSize: number
}
let bannerList = ref<BannerListInt[]>([])
onMounted(() => {
  api.bannerList({ type: 'indexBanner' }).then((res) => {
    bannerList.value = res.data || []
  });
  api.goodsList({})
})

function jumpPage(url: string) {
  if (url) {
    window.location.href = url;
  }
}
</script>

<style scoped>
.swiper {
  width: 100%;
  height: 180px;
}
</style>